Tutorial: 002 - Eureca.io basics

What's eureca.io

Eureca.io is a JavaScript RPC (Remote Procedure Call) Library.
It allows you to call server side function from the client and vice-versa.

Eureca.io actors

Eureca.io involves two main actors, a server and a client.

The Server

eureca.io is the central element of eureca.io.
It contains the server side code, and is considered as the trusty entity.
The server maintains references to each connected client, and allow you to call client exported methods.

The Client

eureca.io support two kinds of clients :

  • Browser client : Javascript running on a browser
  • Nodejs client : Javascript runnint on a nodejs script

The clients are able to call all server exported methods.

Exports

Each eureca.io actor need to export functions to make them available for RPC.

Exporting functions is very simple, you only need to define them under "exports" namespace.

When the server exports a function, it becomes available to the clients without further action.

when clients export function, that function should be explicitly allowed in the server side.

Transports

Eureca.io can use various transport layers, making it easy to switch from one library to another, compare performance and chose the right one.
Supported transports are :

  • engine.io
  • sockjs
  • websocket
  • Faye
  • uws
  • browserchannel

Above transport all relies on XHR and websocket and are reliable transports, they are perfect for applications.
Eureca.io also support webRTC ! which can be used for reliable or unreliable transports making it ideal for games